#  Name:		wifi
#  Version:		0.5
#  Part Of:		linuxrules
#  Modified:	Sun Nov 21 2010, 13:28:33
#  Insects:		Solved a bug with regexp introducing wrong
#				output. The downside is DEVICE NAMES MUST BE
#               SET EXPLICITLY FROM NOW ON... Following
#               guidelines this solution is a BUG too!

#  See COPYING for linuxrules GPL3 licensing info.

BEGIN {
	num = 0
    NR = 0

	while ((getline < "/proc/net/wireless") > 0) {
		NR++
		if ( $1 ~ /wlan|wifi/ ) {
			gsub(/\.|:/, "")
			num++
			_wifi["IFACE",  num] = $1
			_wifi["STATUS", num] = $2
			_wifi["LINK",   num] = $3
			_wifi["LEVEL",  num] = $4
			_wifi["NOISE",  num] = $5
			_wifi["NWID",   num] = $6
			_wifi["CRYPT",  num] = $7
			_wifi["FRAG",   num] = $8
			_wifi["RETRY",  num] = $9
			_wifi["MISC",   num] = $10
			_wifi["BEACON", num] = $11
		}
	} close("/proc/net/wireless")
}

# vim:ft=awk:
